package main

import "fmt"

func main() {
	sign := make(chan struct{}, 10)
	for i := 0; i < 10; i++ {
		go func() {
			fmt.Println(i)
			sign <- struct{}{}
		}()
	}
	for j := 0; j < 10; j++ {
		<- sign
	}
}